-
Notifications
You must be signed in to change notification settings - Fork 111
fix: OpenMP flags incorrectly applied to C/C++ compilers that don't s… #1161
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
#2) * fix: OpenMP flags incorrectly applied to C/C++ compilers that don't support them - Add C and C++ compiler capability testing functions to fpm_compiler.F90 - Modify OpenMP metapackage to test OpenMP support per language individually - Only apply OpenMP flags to languages where the compiler actually supports them - Fixes issue where clang C compiler fails with unsupported -fopenmp flag Resolves fortran-lang#1159 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]> * fix: Add missing temporary file cleanup in C/C++ compiler testing functions - Add cleanup code to check_c_source_runs() and check_cxx_source_runs() - Matches the cleanup pattern used in check_fortran_source_runs() - Prevents accumulation of temporary files during OpenMP capability testing Addresses review feedback from qodo-merge-pro 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]> * test: Add comprehensive test coverage for C/C++ compiler capability functions - Add test_check_c_source_runs() with tests for: - Valid C hello world program - Program that returns error code 1 - Invalid compile flags - check_c_flags_supported() wrapper - Add test_check_cxx_source_runs() with tests for: - Valid C++ hello world program - Program that returns error code 1 - Invalid compile flags - check_cxx_flags_supported() wrapper - Both test suites mirror the existing Fortran tests structure - Tests verify error detection and temporary file cleanup 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]> * test: Improve C/C++ test robustness and fix potential escaping issues - Skip C/C++ tests if compiler is not available - Use simpler test programs to avoid iostream complexities - Use cstdio instead of iostream for better compatibility - Gracefully handle missing or misconfigured C++ compilers These changes make the tests more robust across different environments where C/C++ compilers may not be properly configured. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]> --------- Co-authored-by: Claude <[email protected]>
Ensure the linker always receives OpenMP flags when OpenMP is requested, even if individual C/C++ compilers don't support OpenMP. The linker needs these flags to properly link OpenMP runtime libraries when any compiled objects contain OpenMP code. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]>
Shared libraries were missing model%link_flags which include metapackage flags like OpenMP. This caused OpenMP shared libraries to fail linking as they didn't get the necessary OpenMP runtime library flags. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]>
Nice work @krystophny - do you need help completing this PR? |
- Fix check_c_source_runs() to use C compiler (icx) instead of Fortran compiler (ifx) for linking - Fix check_cxx_source_runs() to use C++ compiler (icpx) instead of Fortran compiler for linking - Resolves "multiple definition of main" error with Intel Fortran compiler - Intel Fortran automatically links for_main.o which conflicts with C main() functions - This enables C/C++ compiler capability testing (e.g., OpenMP flag detection) to work correctly The previous approach of using Fortran compiler for linking pure C/C++ programs caused linker conflicts because Intel Fortran includes its own main entry point. Using the appropriate language compiler for pure language programs is the correct approach. Fixes test failures in check-c-source-runs and check-cxx-source-runs. Related to OpenMP metapackage C/C++ compiler capability detection. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]>
Thanks, should be fine and ready to merge. New C test just uncovered another issue #1165 but that one is a future improvement for an edge case |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thank you @krystophny.
…… (#2)
Resolves #1159
🤖 Generated with Claude Code
Addresses review feedback from qodo-merge-pro
🤖 Generated with Claude Code
Add test_check_c_source_runs() with tests for:
Add test_check_cxx_source_runs() with tests for:
Both test suites mirror the existing Fortran tests structure
Tests verify error detection and temporary file cleanup
🤖 Generated with Claude Code
These changes make the tests more robust across different environments where C/C++ compilers may not be properly configured.
🤖 Generated with Claude Code